package com.example.liuxing.jdmall.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.ImageView;

import com.example.liuxing.jdmall.R;
import com.example.liuxing.jdmall.utils.ActivityUtils;

/**
 * Created by liuxing on 2017/7/13.
 */

public class SplashActivity extends BaseActivity {

    private ImageView logo;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        logo = (ImageView)findViewById(R.id.iv_logo);
        alphaAnim();
    }

    private void alphaAnim() {
        AlphaAnimation alphaAnimation = new AlphaAnimation(0.2f, 1.0f);
        alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                // 启动登录
//                Intent intent = new Intent(SplashActivity.this, LoginActivity.class);
//                startActivity(intent);
                ActivityUtils.start(SplashActivity.this, LoginActivity.class);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
        alphaAnimation.setDuration(3000);
        alphaAnimation.setFillAfter(true);
        logo.startAnimation(alphaAnimation);
    }
}
